package com.yixun.qfbao.hander;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yixun.qfbao.api.service.ThirdPartyApiService;
import com.yixun.qfbao.apidto.CustomerToM2ReqDto;
import com.yixun.qfbao.apidto.CustomerToM2ResDto;
import com.yixun.qfbao.dto.base.BaseRequestDTO;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.hander.base.CommonAbstractHander;
import com.yixun.qfbao.vo.CustomerToM2ReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;

/**
 * （6）	转客
 * 
 * @author jzliu
 *		
 */
@Service("customerToM2Hander")
public class CustomerToM2Hander extends CommonAbstractHander {
	private static Logger logger= LoggerFactory.getLogger(CustomerToM2Hander.class);
	
	@Autowired
	private ThirdPartyApiService thirdPartyApiService;

	@SuppressWarnings("rawtypes")
	@Override
	public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
		CustomerToM2ReqVo req = (CustomerToM2ReqVo)reqDto;
		CustomerToM2ReqDto reqDto1 = req.getParams();
		BaseResponseDTO<CustomerToM2ResDto> res = new BaseResponseDTO<CustomerToM2ResDto>();
		CustomerToM2ResDto resDto = new CustomerToM2ResDto();
		try {
			resDto = thirdPartyApiService.customerToM2(reqDto1);
		} catch (Exception e) {
			logger.error("CustomerToM2Hander error: {}", e);
			resDto.setResult(ResultEnum.FAIL.getNo());
			resDto.setResultMsg("转客失败!");
		}
		res.setResData(resDto);
		res.setResult(resDto.getResult());
		return res;
	}
	
}
